#include <iostream>
#include <algorithm>
#include <cstring>

using namespace std;
using LL = long long;
const int N = 1e5 + 10;
struct Node{
    LL l, r, sum, add;
}node[N * 4];

int n, m;
int q[N];

void pushup(int u){
    node[u].sum = node[u << 1].sum + node[u << 1 | 1].sum;
}

void pushdown(int u){
    Node &root = node[u], &left = node[u << 1], &right = node[u << 1 | 1];
    if(root.add){
        left.add += root.add, left.sum += (left.r - left.l + 1) * root.add;
        right.add += root.add, right.sum += (right.r - right.l + 1) * root.add;
        root.add = 0;
    }
}

void build(int u, int l, int r){
    if(l == r){
        node[u].sum = q[l];
        node[u].l = l;
        node[u].r = r;
        node[u].add = 0;
    }else{
        node[u].l = l, node[u].r = r;
        int mid = (node[u].l + node[u].r) >> 1;
        node[u].add = 0;
        build(u << 1, l, mid), build(u << 1 | 1, mid + 1, r);
        pushup(u);
    }
}

void modify(int u, int l, int r, int k){
    if(node[u].l >= l && node[u].r <= r){
        node[u].sum += (node[u].r - node[u].l + 1) * k;
        node[u].add += k;
    }else{
        pushdown(u);
        int mid = (node[u].l + node[u].r) >> 1;
        if(l <= mid) modify(u << 1, l, r, k);
        if(r > mid) modify(u << 1 | 1, l, r, k);
        pushup(u);
    }
}


LL query(int u, int l, int r){
    if(node[u].l >= l && node[u].r <= r){
        return node[u].sum;
    }else{
        pushdown(u);
        int mid = (node[u].l + node[u].r) >> 1;
        LL res = 0;
        if(l <= mid) res += query(u << 1, l, r);
        if(r > mid) res += query(u << 1 | 1, l, r);
        return res;
    }
}

int main(){
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);

    scanf("%d%d", &n, &m);
    for(int i = 1; i <= n; i ++) scanf("%d", &q[i]);
    build(1, 1, n);

    char op[2];
    int l, r, d;
    while (m --)
    {
        scanf("%s", op);
        if(op[0] == 'C'){
            scanf("%d%d%d", &l, &r, &d);
            modify(1, l, r, d);
        }else{
            scanf("%d%d", &l, &r);
            LL res = query(1, l, r);
            printf("%lld\n", res);
        }
    }
    return 0;

}